/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.migracion.pool;

import org.antlr.stringtemplate.StringTemplate;

/**
 *
 * @author stevenziggiz
 */
public class PostgreSQL extends DriverConnectionPool {

    private PostgreSQL() {
        setTablesList("SELECT table_name FROM information_schema.tables WHERE table_schema = '" + this.getDataBaseName() + "' ORDER BY table_name;");
        setColumnsList("Show COLUMNS IN $TABLE_PARAM$ FROM " + this.getDataBaseName() + ";");
    }

    public PostgreSQL(String ipServer, int port, String dataBaseName, String user, String password) {
        DRIVER_NAME = "org.postgresql.Driver";
        URL = new StringTemplate("jdbc:postgresql://$HOST$:$PORT$/$DATABASE$");
        //Cambia las variables definidas en el Template por los valores correspondientes
        URL.setAttribute("HOST", ipServer);
        URL.setAttribute("PORT", port);
        URL.setAttribute("DATABASE", dataBaseName);
        this.user = user;
        this.password = password;
        this.setDataBaseName(dataBaseName);
    }
}
